package com.skmc.okcashbag.common;

import com.cnt.crypto.SeedCrypt;
import com.cnt.crypto.Engine.Seed;


public class SeedECB {
	public String enCrypter(String data){
		
		//final byte[] iv = new byte[16];
		String _mode = Seed.MODE_ECB;//Seed.MODE_CBC;//Seed.MODE_CFB;//Seed.MODE_OFB
		String _pad = Seed.PAD_X923;//Seed.PAD_PKCS;//Seed.PAD_NO
		String _key = Setting.S_ID;	//key
	
		SeedCrypt encrypter = new SeedCrypt();	
		//ECB 
		encrypter.init(encrypter.ENCRYPT_MODE, _mode, _pad, _key.getBytes());
		String encStr = encrypter.encrypt(data);
	
	    return encStr;
	}
	
	public String enCrypter(String data, String s_id){
		
		//final byte[] iv = new byte[16];
		String _mode = Seed.MODE_ECB;//Seed.MODE_CBC;//Seed.MODE_CFB;//Seed.MODE_OFB
		String _pad = Seed.PAD_X923;//Seed.PAD_PKCS;//Seed.PAD_NO
		String _key = s_id;	//key
	
		SeedCrypt encrypter = new SeedCrypt();	
		//ECB 
		encrypter.init(encrypter.ENCRYPT_MODE, _mode, _pad, _key.getBytes());
		String encStr = encrypter.encrypt(data);
	
	    return encStr;
	}
	
	public String deCrypter(String data){
		
		//final byte[] iv = new byte[16];
		String _mode = Seed.MODE_ECB;//Seed.MODE_CBC;//Seed.MODE_CFB;//Seed.MODE_OFB
		String _pad = Seed.PAD_X923;//Seed.PAD_PKCS;//Seed.PAD_NO
		String _key = Setting.S_ID;	//key 
		
		SeedCrypt decrypter = new SeedCrypt();	
				
		decrypter.init(decrypter.DECRYPT_MODE, _mode, _pad, _key.getBytes());
		String decStr = decrypter.decrypt(data);
		
		return decStr;
		
	}
	
	public String deCrypter(String data, String s_id){
		
		//final byte[] iv = new byte[16];
		String _mode = Seed.MODE_ECB;//Seed.MODE_CBC;//Seed.MODE_CFB;//Seed.MODE_OFB
		String _pad = Seed.PAD_X923;//Seed.PAD_PKCS;//Seed.PAD_NO
		String _key = s_id;	//key 
		
		SeedCrypt decrypter = new SeedCrypt();	
				
		decrypter.init(decrypter.DECRYPT_MODE, _mode, _pad, _key.getBytes());
		String decStr = decrypter.decrypt(data);
		
		return decStr;
		
	}

}
